package com.example.demo.service.impl;

import com.alibaba.fastjson.JSON;
import com.example.demo.domain.dto.OrderDTO;
import com.example.demo.domain.vo.OrderVO;
import com.example.demo.service.OrderService;
import com.example.demo.service.OrderSubService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 * @author kisofdeath
 * @date 2022/5/11 12:32
 */
@Service
public class OrderServiceImpl implements OrderService {
	@Autowired
	private OrderSubFactory orderSubFactory;

	@Override
	public OrderVO order(OrderDTO dto) {
		OrderSubService orderSubService = orderSubFactory.of(dto.getChannel());
		System.out.println(JSON.toJSONString(dto));
		OrderVO result = new OrderVO();
		result.setContent(orderSubService.order(dto));
		return result;
	}
}
